<?php
/* wwwschool project
Copyright (C) 2009  Phillip Aldridge
Email : info@imi21.com
Web site http://www.imi21.com
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

/**
 *
 *  wwwschool project
 *  File : WS3_debug.php
 *   
 */ 

class WS3_Debug { 

  function __construct() {

    $this->display();
   }
   
   function __destruct() {
    //$GLOBALS['W3DEBUG'] = null;
   }
   function display() {
        $debug="<h2>Debug information</h2>";
        foreach ($GLOBALS['W3DEBUG'] as $v){
          $debug.="<p>$v</p>";
        }
        
        if (isset( $_SESSION ) )
        {
          $debug.="<h3>Session information</h3>";
           foreach ($_SESSION as $k=>$v ){
            $debug.="<p>$k = $v</p>";
          }     
        }
        
        if (isset( $_POST ) )
        {
          $debug.="<h3>Post information</h3>";
           foreach ($_POST as $k=>$v ){
            $debug.="<p>$k = $v</p>";
          }     
        }        

        $memory=round(memory_get_usage() / 1024 / 1024, 2) . 'MB';
        $debug.="<p>Memory usage = $memory</p>";
        
        $debug=javaSafeString($debug);
        echo "document.getElementById('debug').innerHTML='$debug';";
    }
}
 
?>